package ninja9.muzik.dao;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Singer entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "singer", catalog = "muzik")
public class Singer implements java.io.Serializable {

	// Fields

	private Integer id;
	private String name;
	private String avartar;
	private String caption;
	private Set<Song> songs = new HashSet<Song>(0);
	private Set<Album> albums = new HashSet<Album>(0);

	// Constructors

	/** default constructor */
	public Singer() {
	}

	/** minimal constructor */
	public Singer(String name, String avartar) {
		this.name = name;
		this.avartar = avartar;
	}

	/** full constructor */
	public Singer(String name, String avartar, String caption, Set<Song> songs,
			Set<Album> albums) {
		this.name = name;
		this.avartar = avartar;
		this.caption = caption;
		this.songs = songs;
		this.albums = albums;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "name", nullable = false, length = 65535)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "avartar", nullable = false, length = 65535)
	public String getAvartar() {
		return this.avartar;
	}

	public void setAvartar(String avartar) {
		this.avartar = avartar;
	}

	@Column(name = "caption")
	public String getCaption() {
		return this.caption;
	}

	public void setCaption(String caption) {
		this.caption = caption;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "singer")
	public Set<Song> getSongs() {
		return this.songs;
	}

	public void setSongs(Set<Song> songs) {
		this.songs = songs;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "singer")
	public Set<Album> getAlbums() {
		return this.albums;
	}

	public void setAlbums(Set<Album> albums) {
		this.albums = albums;
	}

}